import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      children: [
        {
          path: '/user',
          name: 'user',
          // route level code-splitting
          // this generates a separate chunk (about.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import(/* webpackChunkName: "about" */ './views/User.vue')
        },
        {
          path: '/commodity',
          name: 'commodity',
          component: () => import(/* webpackChunkName: "about" */ './views/commodity.vue')
        },
        {
          path: '/commodityList',
          name: 'commodityList',
          meta: {
            title: '商品列表',
            icon: 'md-home',
            hideInMenu: true
          },
          component: () => import(/* webpackChunkName: "about" */ './views/commodity-list.vue')
        },
        {
          path: '/shoppingCar',
          name: 'shoppingCar',
          meta: {
            title: '购物车',
            icon: 'md-home',
            hideInMenu: true
          },
          component: () => import(/* webpackChunkName: "about" */ './views/ShoppingCar.vue')
        },
        {
          path: '/orderList',
          name: 'orderList',
          meta: {
            title: '订单记录',
            icon: 'md-home',
            hideInMenu: true
          },
          component: () => import(/* webpackChunkName: "about" */ './views/OrderList.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import(/* webpackChunkName: "about" */ './views/Login.vue')
    }
  ]
})
